/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InfoPopUp.java
 *
 * Created on 19-giu-2009, 1.29.41
 */

package freimapgsoc;

import java.awt.Point;
import java.awt.Toolkit;
import javax.swing.ImageIcon;

/**
 *
 * @author stefano
 */
public class InfoPopUp extends javax.swing.JFrame {

    /** Creates new form InfoPopUp */
    public InfoPopUp(String msg,String state) {
        initComponents();
        this.setLocationRelativeTo(this);
        msgLabel.setText(msg);
        if(state=="APPROVE"){
            approveButton.setText("OK");
            approveButton.setIcon(new ImageIcon(getClass().getResource("/freimapgsoc/resources/statuok.png")));
        }else if(state=="ERROR"){
            approveButton.setText("Close");
            approveButton.setIcon(new ImageIcon(getClass().getResource("/freimapgsoc/resources/close2.png")));        }
    }

    public InfoPopUp(String msg1, String msg2,String state) {
        initComponents();
        this.setLocationRelativeTo(this);
        msgLabel.setText(msg1);
        msgLabel2.setText(msg2);

        if(state=="APPROVE"){
            approveButton.setText("OK");
            approveButton.setIcon(new ImageIcon(getClass().getResource("/freimapgsoc/resources/statuok.png")));
        }else if(state=="ERROR"){
            approveButton.setText("Close");
            approveButton.setIcon(new ImageIcon(getClass().getResource("/freimapgsoc/resources/close2.png")));        }
    }
    /**
	 * This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 * @return 
	 */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        msgLabel = new javax.swing.JLabel();
        approveButton = new javax.swing.JButton();
        msgLabel2 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance().getContext().getResourceMap(InfoPopUp.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setAlwaysOnTop(true);
        setName("Form"); // NOI18N
        setResizable(false);

        msgLabel.setFont(resourceMap.getFont("msgLabel.font")); // NOI18N
        msgLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        msgLabel.setName("msgLabel"); // NOI18N

        approveButton.setIcon(resourceMap.getIcon("approveButton.icon")); // NOI18N
        approveButton.setText(resourceMap.getString("approveButton.text")); // NOI18N
        approveButton.setName("approveButton"); // NOI18N
        approveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                approveButtonActionPerformed(evt);
            }
        });

        msgLabel2.setFont(resourceMap.getFont("msgLabel.font")); // NOI18N
        msgLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        msgLabel2.setName("msgLabel2"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(124, 124, 124)
                        .addComponent(approveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(msgLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE)
                            .addComponent(msgLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 329, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(msgLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(10, 10, 10)
                .addComponent(msgLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(approveButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void approveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_approveButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_approveButtonActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton approveButton;
    private javax.swing.JLabel msgLabel;
    private javax.swing.JLabel msgLabel2;
    // End of variables declaration//GEN-END:variables

}
